package assdraw2.statusagent.presentation;

import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JTextField;

import assdraw2.common.PresentationWindowListener;
import assdraw2.statusagent.StatusBarControl;

public class StatusBarPresentation extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private StatusBarControl control;
	private JTextField statusTF;

	public StatusBarPresentation(StatusBarControl control) {
		super("Status");
		this.control = control;

		setResizable(false);
		setLayout(new GridLayout(1, 1));
		//setLayout(new FlowLayout());
		
		initComponents();
		
		this.setPreferredSize(new Dimension(500, 60));
		this.pack();
		setLocation(100,500);
		this.setVisible(true);
		
		addWindowListener(new PresentationWindowListener(control));
	}

	private void initComponents() {
		statusTF = new JTextField("Status: " + control.getStatus());
		add(statusTF);
		
	}

	public void updateStatus(){
		statusTF.setText("Status: " + control.getStatus());
	}
	
}
